package com.ttt.gdfood.service;

import com.ttt.gdfood.entity.Collection;
import com.ttt.gdfood.mapper.CollectionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollectionService {
    @Autowired
    CollectionMapper collectionMapper;

    // 根据用户id查找
    public List<Collection> getCollection(int uid){
        return collectionMapper.getCollection(uid);
    }
    // 根据收藏的笔记id删除
    public void delCollectionByCnid(int cn_id){
        collectionMapper.delCollectionByCnid(cn_id);
    }

    // 加收藏笔记
    public void insertCollection(int uid,int cn_id) {
        collectionMapper.insertCollection(uid,cn_id);
    }
}
